Ext.define('NIM.view.Administration.AssetBrand', {
    extend: 'Ext.panel.Panel',
    alias: 'widget.asset_brand',
    id: 'ConfigAssetBrand',
    title: 'Asset Brand',
    region: 'west',
    margin: '5 5 5 5',
//    expanded:false,
//    expandable: true,
    collapsed: true,
    collapsible: true,
    width: 350,
    items: [
        {
            xtype: 'textfield',
            cls: 'black',
            id: 'abIdBrand',
            //emptyText: 'Input Main Category',
            margin: '15 10 10 10',
            labelWidth: 130 / 1366 * screen.width,
            width: 325 / 1366 * screen.width,
            fieldLabel: 'AB ID',
            msgTarget: 'title',
            hidden: true,
            allowBlank: true,
            validateBlank: false,
//		            allowOnlyWhitespace: false
        },
        {
            xtype: 'textfield',
            cls: 'black',
            id: 'scIdBrand',
            //emptyText: 'Input Main Category',
            margin: '15 10 10 10',
            labelWidth: 130 / 1366 * screen.width,
            width: 325 / 1366 * screen.width,
            fieldLabel: 'SC ID',
            msgTarget: 'title',
            hidden: true,
            allowBlank: true,
            validateBlank: false,
//		            allowOnlyWhitespace: false
        },
        {
            xtype: 'textfield',
            cls: 'black',
            id: 'categoryBrand',
            //emptyText: 'Input Main Category',
            margin: '15 10 10 10',
            labelWidth: 130 / 1366 * screen.width,
            width: 325 / 1366 * screen.width,
            fieldLabel: 'Category',
            msgTarget: 'title',
            allowBlank: true,
            validateBlank: false,
//		            allowOnlyWhitespace: false
        },
        {
            xtype: 'textfield',
            cls: 'black',
            id: 'subCategoryBrand',
            //emptyText: 'Input Sub Category 1',
            margin: '10 10 10 10',
            labelWidth: 130 / 1366 * screen.width,
            width: 325 / 1366 * screen.width,
            fieldLabel: 'Sub Category',
            msgTarget: 'title',
            allowBlank: true,
            // allowOnlyWhitespace: false
        },
        {
            xtype: 'textfield',
            cls: 'black',
            id: 'brand',
            //emptyText: 'Input Sub Category 1',
            margin: '10 10 10 10',
            labelWidth: 130 / 1366 * screen.width,
            width: 325 / 1366 * screen.width,
            fieldLabel: 'Brand',
            msgTarget: 'title',
            allowBlank: true,
            // allowOnlyWhitespace: false
        },
        {
            xtype: 'fieldcontainer',
            cls: 'black',
            margin: '10 10 10 10',
            fieldLabel: 'Active',
            labelWidth: 130 / 1366 * screen.width,
            width: 325 / 1366 * screen.width,
            defaultType: 'radiofield',
            defaults: {
                flex: 1
            },
            layout: 'hbox',
            items: [
                {
                    boxLabel: 'Yes',
                    id: 'activeBrand',
                    name: 'active',
                    inputValue: 'y'
                },
                {
                    boxLabel: 'No',
                    id: 'inactiveBrand',
                    name: 'active',
                    inputValue: 'n'
                }
            ]
        },
        {
            xtype: 'button',
            id: 'ButtonInsertBrand',
            margin: '5 10 10 10',
            width: 80 / 1366 * screen.width,
            text: 'Add Brand',
            handler: function () {
                inputAssetBrand();
            }
        },
        {
            xtype: 'button',
            id: 'ButtonClearBrand',
            margin: '5 10 10 0',
            width: 80 / 1366 * screen.width,
            text: 'Clear',
            handler: function () {
                if (Ext.getCmp('ButtonClearBrand').getText() == "Clear") {
                    emptyAssetBrand();
                } else {
                    this.up('.window').close();
                    Ext.getStore('AssetDataMaster.Brand').load();
                }
            }
        },
        {
            xtype: 'button',
            id: 'ButtonAddType',
            margin: '5 10 10 60',
            width: 80 / 1366 * screen.width,
            text: 'Add Type',
            handler: function () {
                if (Ext.getCmp('ConfigAssetType').hidden == true)
                    Ext.getCmp('ConfigAssetType').toggleCollapse(true);
                getValueAssetType();
            }
        },
        {
            xtype: 'grid',
            region: 'center',
            id: 'tableAssetBrand',
            height: 297,
            width: 340,
            titleAlign: 'center',
            margin: '5 5 5 4',
            border: true,
            forceFit: true,
            columnLines: true,
            selType: 'checkboxmodel',
            store: 'Administration.AssetBrand',
            title: 'Asset Sub Category List',
            columns: [
                {dataIndex: 'BRAND', text: 'BRAND', align: 'left', width: '80%'},
                {dataIndex: 'ACTIVE', text: '', align: 'left', width: '20%'},
            ],
            dockedItems: [
                {
                    xtype: 'toolbar',
                    dock: 'top',
                    items: [
                        {
                            xtype: 'textfield',
                            fieldLabel: 'KEYWORD',
                            labelWidth: 50 / 1366 * screen.width,
                            width: 180 / 1366 * screen.width,
                            id: 'keywordBrand',
                            margin: '0 0 0 0',
                        },
                        {
                            xtype: 'button',
                            text: 'SEARCH',
                            id: 'searchBrand',
                            margin: '0 0 0 0',
                            handler: function () {
                                searchAssetBrand();
                            }
                        },
                        {
                            xtype: 'button',
                            text: 'DELETE',
                            id: 'deleteBrand',
                            margin: '0 0 0 0',
                            handler: function () {
                                deleteAssetBrand();
                            }
                        },
                        {
                            xtype: 'button',
                            text: 'REFRESH',
                            id: 'refreshBrand',
                            margin: '0 0 0 0',
                            handler: function () {
                                refreshAssetBrand();
                            }
                        }
                    ]
                },
                {
                    xtype: 'pagingtoolbar',
                    dock: 'bottom',
                    store: 'Administration.AssetBrand',
                    displayInfo: true
                }

            ],
            listeners: {
                itemdblclick: function (grid, record) {
                    getValueGridBrand(record);
                }
            },
        }
    ]
});